package com.hhkj.study.admin.dict.model.res;

import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.Lists;
import com.hhkj.study.admin.dict.model.podo.DictMultiLevelPo;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;
import java.util.Map;

/**
*
* @author SERVER
* @since 2024-09-06
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class DictMultiLevelRes extends DictMultiLevelPo {

    private List<Map<String, Object>> extendTypeMap;
    /**
     * 课程类别|隔开
     */
    private String extendTypeValue;

    private List<Map<String, Object>> extendIdMap;
    /**
     * 所属区域|隔开
     */
    private String extendIdValue;

    /**
     * 展示内容
     */
    private String content;

    @JsonIgnore
    @Override
    public List<Long> getExtendTypeList() {
        if (StrUtil.isBlank(getExtendTypes())) {
            return Lists.newArrayList();
        }
        return JSONUtil.toList(getExtendTypes(), Long.class);
    }

    @JsonIgnore
    @Override
    public List<Long> getExtendIdList() {
        if (StrUtil.isBlank(getExtendIds())) {
            return Lists.newArrayList();
        }
        return JSONUtil.toList(getExtendIds(), Long.class);
    }
}